package com.yuda.afterexamscore.service.impl;

import com.yuda.afterexamscore.domain.ThDimensionQuestion;
import com.yuda.afterexamscore.mapper.ThDimensionQuestionMapper;
import com.yuda.afterexamscore.service.IThDimensionQuestionService;
import com.yuda.common.core.utils.DateUtils;
import com.yuda.common.core.utils.IdUtils;
import com.yuda.common.datasource.annotation.Slave;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 题目维度关系Service业务层处理
 ***
 * @author wyn
 * @date 2021-05-12
 */
@Service
public class ThDimensionQuestionServiceImpl implements IThDimensionQuestionService
{
    @Resource
    private ThDimensionQuestionMapper thDimensionQuestionMapper;

    /**
     * 查询题目维度关系
     *
     * @param uuid 题目维度关系ID
     * @return 题目维度关系
     */
    @Slave
    @Override
    public ThDimensionQuestion selectThDimensionQuestionById(String uuid)
    {
        return thDimensionQuestionMapper.selectThDimensionQuestionById(uuid);
    }

    /**
     * 查询题目维度关系列表
     *
     * @param thDimensionQuestion 题目维度关系
     * @return 题目维度关系
     */
    @Slave
    @Override
    public List<ThDimensionQuestion> selectThDimensionQuestionList(ThDimensionQuestion thDimensionQuestion)
    {
        return thDimensionQuestionMapper.selectThDimensionQuestionList(thDimensionQuestion);
    }
    /**
     * 新增题目维度关系
     *
     * @param thDimensionQuestion 题目维度关系
     * @return 结果
     */
    @Slave
    @Override
    public int insertThDimensionQuestion(ThDimensionQuestion thDimensionQuestion)
    {
        thDimensionQuestion.setCreateTime(DateUtils.getNowDate());
        thDimensionQuestion.setUuid(IdUtils.fastSimpleUUID());
        return thDimensionQuestionMapper.insertThDimensionQuestion(thDimensionQuestion);
    }

    /**
     * 修改题目维度关系
     *
     * @param thDimensionQuestion 题目维度关系
     * @return 结果
     */
    @Slave
    @Override
    public int updateThDimensionQuestion(ThDimensionQuestion thDimensionQuestion)
    {
        thDimensionQuestion.setUpdateTime(DateUtils.getNowDate());
        return thDimensionQuestionMapper.updateThDimensionQuestion(thDimensionQuestion);
    }

    /**
     * 批量删除题目维度关系
     *
     * @param uuids 需要删除的题目维度关系ID
     * @return 结果
     */
    //
    @Slave
    @Override
    public int deleteThDimensionQuestionByIds(String[] uuids)
    {
        return thDimensionQuestionMapper.deleteThDimensionQuestionByIds(uuids);
    }

    /**
     * 删除题目维度关系信息
     *
     * @param uuid 题目维度关系ID
     * @return 结果
     */
    @Slave
    @Override
    public int deleteThDimensionQuestionById(String uuid)
    {
        return thDimensionQuestionMapper.deleteThDimensionQuestionById(uuid);
    }
    @Slave
    @Override
    public int insertThDimensionQuestionList(List<ThDimensionQuestion> list) {
       return thDimensionQuestionMapper.insertThDimensionQuestionList(list);
    }
}
